package com.baidu.www;

/**
 * ClassName: test
 * Package: com.baidu.www
 * Description:
 *
 * @Author 蒋林康
 * @Create 2023/10/7 10:21
 * @Version 1.0
 */
class father{
    public void work(){
        System.out.println("种田");
    }
}
class  son extends father{
    public void work(){
        System.out.println("读书");
    }
}
class grandson extends son{
    public void work(){
        System.out.println("躺平");
    }
}
public class test {
    public static void work(father f){
        f.work();
    }
    public static void main(String[] args) {
        son s1=new son();
        work(s1);

        grandson g1=new grandson();
        work(g1);
        father f1=new son();
        System.out.println(f1 instanceof son);
        System.out.println(f1 instanceof grandson);
    }
}
